#!/usr/bin/env bash
set -e
mkdir -p /opt/tmp/
name="go1.9.2"

wget https://studygolang.com/dl/golang/${name}.linux-amd64.tar.gz
mkdir /opt/${name} && tar -zxvf ${name}.tar.gz -C  /opt/${name}  --strip-components 1


echo -e "export GOROOT=/opt/go">>/etc/profile
echo -e "PATH=\$PATH:\$GOROOT/bin">>/etc/profile
echo -e "GOPATH=/opt/gosrc">>/etc/profile
